package com.tueye.dao.impl.userblog;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.tueye.base.util.BaseDao;
import com.tueye.base.util.IBaseHbnDao;
import com.tueye.dao.userblog.IWebSiteEmailDao;
import com.tueye.entity.user.User;
import com.tueye.entity.user.WebSiteEmailInfo;
/**
 * 
 * @author hanxiaowei
 *
 */
@Scope("prototype")
@Component("webSiteEmailDao")
public class WebSiteEmailDaoImpl extends BaseDao implements IWebSiteEmailDao {
	
	@Autowired
	@Qualifier("baseHbnDao")
	private IBaseHbnDao  baseHbnDao;
	
	@Override
	public void saveWebSiteEmail(WebSiteEmailInfo webSiteEmail) {
		baseHbnDao.saveOrUpdate(webSiteEmail);
	}

	@Override
	public User getUserToUsername(String username) {
		List list = new ArrayList();
		//Object[] values = new Object[1];
		//values[0]= username;
		list = baseHbnDao.queryList("from com.tueye.entity.user.User where email='"+username+"'");
		User user = new User();
		user = (User) list.get(0);
		return user;
	}

	@Override
	public List getInboxInfo(String userid) {
		
		return baseHbnDao.queryList("from com.tueye.entity.user.WebSiteEmailInfo where userid ='"+userid+"'");
	}

}
